<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript">
		function page(n,s){
			$("#pageNoLeft").val(n);
			$("#pageSizeLeft").val(s);
			$("#searchFormDict").submit();
        	return false;
        }
        function namepage(n,s){
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }
        function loadRightDiv(divId,url){
            var val=$('input:radio[name="drugNameId"]:checked').val();
            if(val!=null){
                $("#"+divId).load(url);
            }else{
                toastr.error("请先选择左侧药品名称数据");
            }
        }
        function loadDivFun(divId,url,nameId){
            $("input:radio[value="+nameId+"]").prop("checked",true);
            $("#"+divId).load(url);
        }
    function basePrice(msg,divId,url,hrefUrl){
        confirmExtend(msg,function(){
            $.ajax({
                type: "POST",
                url: url,
                dataType: "json",
                success: function (data) {
                    if (data.code == "success") {
                        toastr.success(data.data);
                        $("#"+divId).load(hrefUrl);
                    }else if(data.code == "info"){
                        toastr.info(data.data);
                    }else {
                        toastr.error(data.data);
                    }
                },
                error: function(data) {
                    toastr.error('网络连接错误,请检查网络');
                }
            });
        });
    }

</script>
<div class="app">
    <section class="layout">
        <section class="main-content col-lg-4">
            <div class="content-wrap" id="nameLeftDiv">
                <div class="wrapper" style="bottom: 50px;">
                    <section class="panel panel-default">
                        <div class="panel-body">
                            <div class="table-responsive no-border">
                                <div class="datatable-top">
                                    <div class="pull-left">
                                        <form:form id="searchFormDict" modelAttribute="drugNameDict"  onsubmit="return loadDivForm('mainCenterDiv','searchFormDict','${ctx}/drug/drugPrice/priceIndex');" method="post" class="form-inline">
                                            <input id="pageNoLeft" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                            <input id="pageSizeLeft" name="pageSize" type="hidden" value="${page.pageSize}"/>
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label">药品代码：</label>
                                                <div class="col-sm-8">
                                                    <form:input path="drugCode" htmlEscape="false" maxlength="50" class="form-control" />
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label">药品名称：</label>
                                                <div class="col-sm-8">
                                                    <form:input path="drugName" htmlEscape="false" maxlength="50" class="form-control" />
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <input id="btnSubmits" class="btn btn-primary" type="submit" value="查询"/>
                                            </div>

                                        </form:form>
                                    </div>
                                </div>
                                <table id="contentTable" class="table table-bordered mg-t datatable">
                                    <thead>
                                    <tr>
                                        <th></th>
                                        <th>药品代码</th>
                                        <th>药品名称</th>
                                       <%-- <th>输入码</th>--%>
                                       <%-- <th>备注</th>--%>

                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${namepage.list}" var="drugNameDict">
                                    <tr onclick="loadDivFun('priceRightDiv','${ctx}/drug/drugPrice/index?drugInfo.drugDict.drugCode=${drugNameDict.drugCode}','${drugNameDict.id}')">
                                        <td><input type="radio" name="drugNameId"  value="${drugNameDict.id}" /></td>
                                        <td> ${drugNameDict.drugCode}</td>
                                        <td> ${drugNameDict.drugName}</td>
                                   <%--     <td> ${drugNameDict.inputCode}</td>
                                        <td> ${drugNameDict.remarks}</td>--%>
                                    </tr>
                                    </c:forEach>

                                </table>
                                <div class="pagination">${namepage}</div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>
        <section class="main-content col-lg-8">
            <div class="content-wrap" id="priceRightDiv">
                <div class="wrapper" style="bottom: 50px;">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a href="#"   onclick="loadDiv('priceRightDiv','${ctx}/drug/drugPrice/index')">药品价格列表</a>
                        </li>
                        <li>
                            <a href="#" onclick="loadRightDiv('priceRightDiv','${ctx}/drug/drugPrice/form?drugInfo.drugDict.drugCode=${drugPrice.drugInfo.drugDict.drugCode}')">药品价格添加</a>
                        </li>
                    </ul>
                    <section class="panel panel-default">
                        <div class="panel-body">
                            <div class="table-responsive no-border">
                                <div class="datatable-top">
                                    <div class="pull-left">
                                        <%--<form:form id="searchPriceForm" modelAttribute="drugPrice"  onsubmit="return loadDivForm('priceRightDiv','searchPriceForm','${ctx}/drug/drugPrice/index');" method="post" class="form-inline">--%>
                                            <%--<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>--%>
                                            <%--<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>--%>

                                            <%--<div class="form-group">--%>
                                                <%--<label class="col-sm-4 control-label">药品代码：</label>--%>
                                                <%--<div class="col-sm-8">--%>
                                                    <%--<form:input path="drugInfo.drugDict.drugCode" id="" htmlEscape="false" maxlength="50" class="form-control" />--%>
                                                <%--</div>--%>
                                            <%--</div>--%>
                                            <%--<div class="form-group">--%>
                                                <%--<label class="col-sm-4 control-label">药品名称：</label>--%>
                                                <%--<div class="col-sm-8">--%>
                                                    <%--<form:input path="drugInfo.drugDict.drugName" htmlEscape="false" maxlength="50" class="form-control" />--%>
                                                <%--</div>--%>
                                            <%--</div>--%>
                                            <%--<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>--%>

                                        <%--</form:form>--%>
                                    </div>
                                </div>
                                <%--<table id="contentTables" class="table table-bordered mg-t datatable">--%>
                                    <%--<thead>--%>
                                    <%--<tr>--%>
                                        <%--<th>药品代码</th>--%>
                                        <%--<th>药品名称</th>--%>
                                        <%--<th>包装规格</th>--%>
                                        <%--<th>药品单位</th>--%>
                                        <%--<th>药品厂商</th>--%>
                                        <%--<th>批发价/元</th>--%>
                                        <%--<th>零售价/元</th>--%>
                                        <%--<th>起用日期</th>--%>
                                     <%--&lt;%&ndash;   <th>费用分类</th>--%>
                                        <%--<th>核算项目分类</th>--%>
                                        <%--<th>会计科目</th>--%>
                                        <%--<th>病案首页分类</th>&ndash;%&gt;--%>
                                        <%--<th>最高限价/元</th>--%>
                                        <%--<th>操作</th>--%>
                                    <%--</tr>--%>
                                    <%--</thead>--%>
                                    <%--<tbody>--%>
                                    <%--<c:forEach items="${page.list}" var="drugPrice">--%>
                                    <%--<tr>--%>
                                        <%--<td> ${drugPrice.drugInfo.drugDict.drugCode}</td>--%>
                                        <%--<td> ${drugPrice.drugInfo.drugDict.drugName}</td>--%>
                                        <%--<td> ${drugPrice.packageSpec}</td>--%>
                                        <%--<td> ${fns:getDictLabels(drugPrice.units, 'SPEC_UNIT', '')}</td>--%>
                                        <%--<td> ${drugPrice.drugInfo.drugSupplierCata.supplierName}</td>--%>
                                        <%--<td> ${drugPrice.tradePrice}</td>--%>
                                        <%--<td> ${drugPrice.retailPrice}</td>--%>
                                        <%--<td> <fmt:formatDate value="${drugPrice.startDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>--%>
                                     <%--&lt;%&ndash;   <td> ${fns:getDictLabels(drugPrice.classOnRcpt, 'RECK_ITEM_CLASS_DICT', '')}</td>--%>
                                        <%--<td> ${fns:getDictLabels(drugPrice.classOnReckoning, 'RECK_ITEM_CLASS_DICT', '')}</td>--%>
                                        <%--<td> ${fns:getDictLabels(drugPrice.subjCode, 'TALLY_SUBJECT_DICT', '')}</td>--%>
                                        <%--<td> ${drugPrice.classOnMr}</td>&ndash;%&gt;--%>
                                        <%--<td> ${drugPrice.priceMax}</td>--%>
                                        <%--<td>--%>
                                            <%--<a href="#" onclick="basePrice('确认要生成药品的基本价格吗？','priceRightDiv','${ctx}/drug/drugPrice/basicPrice?id=${drugPrice.id}','${ctx}/drug/drugPrice/index?drugInfo.drugDict.drugCode=${drugPrice.drugInfo.drugDict.drugCode}')" class="btn btn-primary btn-xs">生成基本价格</a>--%>
                                           <%--&lt;%&ndash; <a href="#" onclick="loadDiv('priceRightDiv','${ctx}/drug/drugPrice/form?id=${drugPrice.id}')" class="btn btn-success btn-xs">修改</a>&ndash;%&gt;--%>
                                            <%--<a href="#"  class="btn btn-danger btn-xs" onclick="basePrice('您确认要停用该药品吗？','priceRightDiv','${ctx}/drug/drugPrice/stopPrice?id=${drugPrice.id}',--%>
                                                    <%--'${ctx}/drug/drugPrice/index?drugInfo.drugDict.drugCode=${drugPrice.drugInfo.drugDict.drugCode}')">停价</a>--%>
                                        <%--</td>--%>
                                    <%--</tr>--%>
                                    <%--</c:forEach>--%>

                                <%--</table>--%>
                                <%--<div class="pagination">${page}</div>--%>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>
    </section>
</div>
